﻿@{
    ViewBag.Title = "RptStockDetail";
}
@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>       
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;"> 
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">
                <a class="mini-button" id="refresh" iconCls="icon-search" onclick="search" plain="true">刷新</a>
                <span class="separator"></span>
                <a class="mini-button" id="export" iconCls="icon-node" onclick="setExportExcel('datagrid1')"plain="true">导出</a>
                <span class="separator"></span>
                <a class="mini-button" id="close" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
            </td>
        </tr>
    </table>                
</div>
<form id="form1">
    <div id = "DivHeader" style="margin-left:0px;margin-top:0px;">
        <table>
            <tr>
                <td width="80px"align="right">门店名称：</td>
                <td width="200px">
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")
                </td>
                <td width ="100px" align="right">进销存期间：</td>
                <td width ="120px">
                    <input id="FDate" name="FDate" class="mini-monthpicker" style="width:120px;" value="2010-01"/>
                </td>
            </tr>
            <tr>
                <td width ="80px" align="right">商品分类：</td>
                <td width ="200px">    
                    @Html.Partial("~/Views/Modular/LookupGoodsClass.cshtml")
                </td>
                <td width ="100px" align="right">商品名称：</td>
                <td width ="200px">    
                    @Html.Partial("~/Views/Modular/LookupGoodInfo.cshtml")
                </td>
            </tr>
        </table>
    </div>
</form>
        <div class="mini-fit" >
            <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" pageSize="15"
                borderStyle="border:1;" url="../Account/GetRptStockInventory" showSummaryRow="false"
                allowCellSelect="true" allowCellEdit="true" showColumnsMenu="false" fitColumns="false">
                <div property="columns">                    
                    <div field="FRechName" name="FRechName" width="80" headeralign="center" allowsort="true">帐套期间</div>
                    <div field="FCode" name="FCode" width="110" headeralign="center" allowsort="true">商品条码</div>
                    <div field="FName" name="FName" width="190" headeralign="center" allowsort="true">商品名称</div>
                    <div field="FSpec" name="FSpec" width="90" headeralign="center" allowsort="true">规格型号</div>
                    <div field="FUnitName" name="FUnitName" width="60" headeralign="center" allowsort="true">单位</div>
                    <div header="期初" headerAlign="center">>
                        <div property="columns">
                            <div field="FQty_Begin" name="FQty_Begin" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">期初数量</div>
                            <div field="FPrice_Begin" name="FPrice_Begin" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">期末单价</div>
                            <div field="FAmount_Begin" name="FAmount_Begin" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">期初金额</div>
                        </div>
                    </div>
                    <div header="收入">
                        <div property="columns">
                            <div width="260" headerAlign="center">采购入库
                                <div property="columns">
                                    <div field="FQty_Ins" name="FQty_Ins" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">采购入库数量</div>
                                    <div field="FPrice_Ins" name="FPrice_Ins" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">采购入库单价</div>
                                    <div field="FAmount_Ins" name="FAmount_Ins" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">采购入库金额</div>
                                </div>
                            </div>
                            <div width="260" headerAlign="center">配送入库
                                <div property="columns">
                                    <div field="FQty_DawIn" name="FQty_DawIn" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">配送入库数量</div>
                                    <div field="FPrice_DawIn" name="FPrice_DawIn" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">采购入库单价</div>
                                    <div field="FAmount_DawIn" name="FAmount_DawIn" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">配送入库金额</div>
                                </div>
                            </div>
                            <div width="240" headerAlign="center">调拨入库
                                <div property="columns">
                                    <div field="FQty_RmoIn" name="FQty_RmoIn" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">调入数量</div>
                                    <div field="FPrice_RmoIn" name="FPrice_RmoIn" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">调入单价</div>
                                    <div field="FAmount_RmoIn" name="FAmount_RmoIn" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">调入金额</div>
                                </div>
                            </div>
                            <div width="260" headerAlign="center">库存调整
                                <div property="columns">
                                    <div field="FQty_Inv" name="FQty_Inv" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">库存调整数量</div>
                                    <div field="FPrice_Inv" name="FPrice_Inv" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">库存调整单价</div>
                                    <div field="FAmount_Inv" name="FAmount_Inv" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">库存调整金额</div>
                                </div>
                            </div>
                            <div width="240" headerAlign="center">盘盈
                                <div property="columns">
                                    <div field="FQty_ChkProfit" name="FQty_ChkProfit" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">盘盈数量</div>
                                    <div field="FPrice_ChkProfit" name="FPrice_ChkProfit" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">盘盈单价</div>
                                    <div field="FAmount_ChkProfit" name="FAmount_ChkProfit" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">盘盈金额</div>
                                </div>
                            </div>
                            <div width="240" headerAlign="center">入库合计
                                <div property="columns">
                                    <div field="FQty_TotalIn" name="FQty_TotalIn" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">总入库数量</div>
                                    <div field="FPrice_TotalIn" name="FPrice_TotalIn" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">总入库单价</div>
                                    <div field="FAmount_TotalIn" name="FAmount_TotalIn" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">总入库金额</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div header="支出">
                        <div property="columns">
                            <div width="240" headerAlign="center">零售出库
                                <div property="columns">
                                    <div field="FQty_Pos" name="FQty_Pos" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">零售数量</div>
                                    <div field="FPrice_Pos" name="FPrice_Pos" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">零售单价</div>
                                    <div field="FCostAmt_Pos" name="FCostAmt_Pos" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">零售金额</div>
                                </div>
                            </div>
                            <div width="240" headerAlign="center">批发出库
                                <div property="columns">
                                    <div field="FQty_Out" name="FQty_Out" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">批发数量</div>
                                    <div field="FPrice_Out" name="FPrice_Out" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">批发单价</div>
                                    <div field="FCostAmt_Out" name="FCostAmt_Out" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">批发金额</div>
                                </div>
                            </div>
                            <div width="260" headerAlign="center">电商出库
                                <div property="columns">
                                    <div field="FQty_Mall" name="FQty_Mall" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">电商出库数量</div>
                                    <div field="FPrice_Mall" name="FPrice_Mall" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">电商出库单价</div>
                                    <div field="FCostAmt_Mall" name="FCostAmt_Mall" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">电商出库金额</div>
                                </div>
                            </div>
                            <div width="260" headerAlign="center">配送出库
                                <div property="columns">
                                    <div field="FQty_DawOut" name="FQty_DawOut" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">配送出库数量</div>
                                    <div field="FPrice_DawOut" name="FPrice_DawOut" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">配送出库单价</div>
                                    <div field="FCostAmt_DawOut" name="FCostAmt_DawOut" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">配送出库金额</div>
                                </div>
                            </div>
                            <div width="260" headerAlign="center">调拨出库
                                <div property="columns">
                                    <div field="FQty_RmoOut" name="FQty_RmoOut" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">调拨出库数量</div>
                                    <div field="FPrice_RmoOut" name="FPrice_RmoOut" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">调拨出库单价</div>
                                    <div field="FAmount_RmoOut" name="FAmount_RmoOut" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">调拨出库金额</div>
                                </div>
                            </div>
                            <div width="260" headerAlign="center">采购退货出库
                                <div property="columns">
                                    <div field="FQty_InsRt" name="FQty_InsRt" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">采购退货数量</div>
                                    <div field="FPrice_InsRt" name="FPrice_InsRt" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">采购退货单价</div>
                                    <div field="FAmount_InsRt" name="FAmount_InsRt" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">采购退货金额</div>
                                </div>
                            </div>
                            <div width="240" headerAlign="center">盘亏出库
                                <div property="columns">
                                    <div field="FQty_ChkLoss" name="FQty_ChkLoss" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">盘亏数量</div>
                                    <div field="FPrice_ChkLoss" name="FPrice_ChkLoss" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">盘亏单价</div>
                                    <div field="FAmount_ChkLoss" name="FAmount_ChkLoss" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">盘亏金额</div>
                                </div>
                            </div>
                            <div width="240" headerAlign="center">报损出库
                                <div property="columns">
                                    <div field="FQty_Loss" name="FQty_Loss" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">报损数量</div>
                                    <div field="FPrice_Loss" name="FPrice_Loss" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">报损单价</div>
                                    <div field="FAmount_Loss" name="FAmount_Loss" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">报损金额</div>
                                </div>
                            </div>
                            <div width="240" headerAlign="center">出库合计
                                <div property="columns">
                                    <div field="FQty_TotalOut" name="FQty_TotalOut" width="80" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">总出库数量</div>
                                    <div field="FPrice_TotalOut" name="FPrice_TotalOut" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">总出库单价</div>
                                    <div field="FAmount_TotalOut" name="FAmount_TotalOut" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">总出库金额</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div header="期末" headerAlign="center">>
                        <div property="columns">
                            <div field="FQty_End" name="FQty_End" width="85" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">期末数量</div>
                            <div field="FPrice_End" name="FPrice_End" width="70" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">期末单价</div>
                            <div field="FAmount_End" name="FAmount_End" width="90" headeralign="center" align="right" allowsort="true" numberFormat="#,0.00">期末金额</div>
                        </div>
                    </div>
                    <div field="FNumber" name="FNumber" width="110" headeralign="center" allowsort="true">商品编码</div>
                    <div field="FStockName" name="FStockName" width="150" headeralign="center" allowsort="true">门店名称</div>
                </div>
            </div>
        </div>
<script>
    var sumFields = "";
    mini.parse();
    var grid = mini.get("datagrid1");
    //通用shown自动调用些方式
    function FormShown() {
    }

    $(function () {
        var nowDate = new Date();
        var currentMonth = nowDate.getMonth();
        var currentYear = nowDate.getFullYear()
        if (currentMonth == 0)
        {
            currentYear = currentYear - 1;
            currentMonth = 12;
        }
        var dtStart = currentYear + "-" + currentMonth;
        mini.getbyName("FDate").setValue(dtStart);
        LoadListData();
    });
        
    //加载资料列表
    function LoadListData() {
        var mDate = mini.getbyName("FDate").getFormValue();
        var mGoodsID = mini.getbyName("FGoodItemID").getValue();
        var mStockID = mini.getbyName("FStockID").getValue();
        var mClassID = mini.getbyName("FClassNumber").getValue();
        var sSystemAppID = parent.window.getSystemAppID();
        var json = "[{";
        json = json + '"FSystemAppID":' + '"' + sSystemAppID + '",';
        json = json + '"mReckData":' + '"' + mDate + '",';
        json = json + '"mGoodsID":' + '"' + mGoodsID + '",';
        json = json + '"mClassID":' + '"' + mClassID + '",';
        json = json + '"mStockID":' + '"' + mStockID + '"';     
        json = json + "}]";        
        grid.load({ mydata: json });

        mExportDataUrl = grid.url;
        mExportDataJson = json;
    }


    //搜索资料列表
    function search() {
        LoadListData();
    }

</script>